| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Quaternion.h
1 // Quaternion.h
3 //
5
6 namespace nkMaths
7 {
13 class Quaternion
14 {
15 public :
16
21 Quaternion () noexcept ;
30 Quaternion (float x, float y, float z, float w) noexcept ;
37 Quaternion (const Vector& axis, float angle) noexcept ;
43 Quaternion (const Vector& eulerAngles) noexcept ;
50 Quaternion (const Vector& a, const Vector& b) noexcept ;
56 Quaternion (const Matrix& mat) noexcept ;
62 Quaternion (const Quaternion& other) noexcept ;
63
67 Vector getAsEulerAngles () const ;
71 Vector getAsAxisAngle () const ;
72
80 Quaternion& setFromAxisAngle (const Vector& axis, float angle) ;
87 Quaternion& setFromEuler (const Vector& angles) ;
95 Quaternion& setFromRotationBetween (const Vector& a, const Vector& b) ;
102 Quaternion& setFromOrientationMatrix (const Matrix& mat) ;
109 Quaternion& setFromTransformationMatrix (const Matrix& mat) ;
110
111 // Transformations
119 Vector transform (const Vector& vector) const ;
127 Vector& apply (Vector& vector) const ;
128
129 // Utilities
133 nkMemory::String toString () const ;
141 Quaternion& fromString (nkMemory::StringView str) ;
142
143 // Operators
149 Quaternion& operator= (const Quaternion& other) noexcept ;
156 Vector operator* (const Vector& other) const ;
163 Quaternion operator* (const Quaternion& other) const ;
169 void operator*= (const Quaternion& other) ;
176 bool operator== (const Quaternion& other) const ;
177
178 public :
179
180 // Attributes
181 float _x ;
182 float _y ;
183 float _z ;
184 float _w ;
185 } ;
186 }
nkMaths::Quaternion::getAsAxisAngle
Vector getAsAxisAngle() const
nkMaths::Quaternion::_z
float _z
Z component of the quaternion.
Definition: Quaternion.h:183
nkMaths
Encompasses all API of component NilkinsMaths.
Definition: IntVector.h:7
nkMaths::Quaternion
A quaternion, symbolizing rotations as a 4D vector.
Definition: Quaternion.h:14
nkMaths::Quaternion::apply
Vector & apply(Vector &vector) const
nkMaths::Quaternion::setFromEuler
Quaternion & setFromEuler(const Vector &angles)
nkMaths::Matrix
Represents a 4x4 float matrix.
Definition: Matrix.h:15
nkMaths::Quaternion::_y
float _y
Y component of the quaternion.
Definition: Quaternion.h:182
nkMaths::Quaternion::setFromAxisAngle
Quaternion & setFromAxisAngle(const Vector &axis, float angle)
nkMaths::Quaternion::toString
nkMemory::String toString() const
nkMaths::Quaternion::setFromOrientationMatrix
Quaternion & setFromOrientationMatrix(const Matrix &mat)
nkMaths::Quaternion::setFromTransformationMatrix
Quaternion & setFromTransformationMatrix(const Matrix &mat)
nkMaths::Quaternion::Quaternion
Quaternion() noexcept
nkMaths::Quaternion::transform
Vector transform(const Vector &vector) const
nkMaths::Quaternion::_x
float _x
X component of the quaternion.
Definition: Quaternion.h:181
nkMaths::Quaternion::_w
float _w
W component of the quaternion.
Definition: Quaternion.h:184
nkMaths::Quaternion::fromString
Quaternion & fromString(nkMemory::StringView str)
nkMaths::Quaternion::getAsEulerAngles
Vector getAsEulerAngles() const
nkMaths::Quaternion::setFromRotationBetween
Quaternion & setFromRotationBetween(const Vector &a, const Vector &b)
nkMaths::Vector
A 4-component vector class, with floats.
Definition: Vector.h:12
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7